/*
 * User: dvetters
 * Date: 8/17/2010
 * Time: 11:12 AM
 * 
 * 
 */
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace Echium2
{
	/// <summary>
	/// Description of PlayQueueListView.
	/// </summary>
	public partial class PlayQueueListView : ListView
	{
		/// <returns>
		/// True if there are queued tracks waiting, false otherwise
		/// </returns>
		public bool QueuedTracks
		{
			get { return (this.Items.Count>0); }
		}
		
		public PlayQueueListView()
		{
			InitializeComponent();
		}
		
		/// <summary>
		/// Adds a libSharpPod Track to the end of the play queue
		/// </summary>
		/// <param name="track">
		/// Track to add
		/// </param>
		public void AddToQueue(EchiumTrack track)
		{
			ListViewItem item = new ListViewItem(track.Title + ((!string.IsNullOrEmpty(track.Artist))?" - " + track.Artist:""));
			item.Tag = track;
            this.Items.Add(item);
		}
		
		public EchiumTrack GetNextQueuedTrack(bool removeTrackFromQueue)
		{
			EchiumTrack ret = (this.Items.Count>0)?(EchiumTrack)this.Items[0].Tag:null;
			if (ret != null)
			{
				if (removeTrackFromQueue)
				{
					this.Items.RemoveAt(0);
				}
			}
			return ret;
		}
	}
}
